package com.mes.basicdata.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.mes.basicdata.dao.iface.IXbomDetailDao;
import com.mes.basicdata.domain.XbomDetail;
import com.mes.common.dao.BasicDao;

@Repository
public class XbomDetailDao extends BasicDao<XbomDetail> implements IXbomDetailDao{	
	
	
	public List<XbomDetail> getByXbomUidAndParentPartUid(String xbomUid,
			String partUid) {
		  
		List<XbomDetail> list = null;
		try {
			Session session = this.getSession();
			Criteria crit = session.createCriteria(XbomDetail.class);
			crit.add(Restrictions.eq("xbomUid", xbomUid));
			crit.add(Restrictions.eq("parentPartUid", partUid));
			
			list = crit.list();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		return list;
	}
	
}
